﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace VisionCloud.Core.Model.Sys
{
    /// <summary>
    /// 消息通知表
    /// </summary>
    [Table("SysNotification")]

    public class SysNotification : BaseEntity
    {
        [Key]
        [Required]
        [Column(TypeName = "uuid")]
        public Guid Id { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        [Column(TypeName = "varchar(100)")]
        public string Title { get; set; }

        /// <summary>
        /// 消息内容
        /// </summary>
        [Column(TypeName = "text")]
        public string MessageContent { get; set; }

        /// <summary>
        /// 通知信息类型
        /// </summary>
        [Column(TypeName = "int2")]
        public MessageType MessageType { get; set; }

        /// <summary>
        /// 保留天数，从创建日期开始算
        /// </summary>
        [Required]
        [Column(TypeName = "int2")]
        public int KeepDays { get; set; } = 30;

        [Column(TypeName = "uuid")]
        public Guid? CompanyId { get; set; }

        /// <summary>
        /// 是否是私有的，若为false，则通知所有用户
        /// </summary>
        [Column(TypeName = "bool")]
        public bool IsPrivate { get; set; } = false;
    }

    /// <summary>
    /// 通知信息类型
    /// </summary>
    public enum MessageType
    {
        /// <summary>
        /// 更新类型
        /// </summary>
        Update = 0,

        /// <summary>
        /// 提示类型
        /// </summary>
        Tips = 1,
    }
}
